import { Controller, Post, Body, Get, Query, Param } from '@nestjs/common';
import { HddService } from './hdd.service';

@Controller('hdd')
export class HddController {
  constructor(private readonly hddService: HddService) {}

  @Post('/info')
  createSsdInfo(@Body() body) {
    return this.hddService.createHddInfo(body);
  }

  @Get('/info')
  getSsdInfo(@Query() query) {
    return this.hddService.getHddInfo(query);
  }

  @Get('/info/:id')
  getSsdInfoById(@Param('id') id: string) {
    return this.hddService.getHddInfoById(id);
  }

  //修改Hdd信息
  @Post('/info/:id')
  updateSsdInfo(@Param('id') id: string, @Body() body: any) {
    return this.hddService.updateHddInfo(id, body);
  }

  //删除Hdd信息
  @Post('/info/delete/:id')
  deleteSsdInfo(@Param('id') id: string) {
    return this.hddService.deleteHddInfo(id);
  }

  //请求所有Hdd信息
  @Get('/total')
  getTotal() {
    return this.hddService.getTotal();
  }
}
